DATEDIF
Calculates the difference between two dates in various units.
Syntax
DATEDIF(start_date, end_date, unit)
Arguments
start_date
: The starting date.end_date
: The ending date.unit
: The unit of time for the calculation. Valid values include:- "Y": Years
- "M": Months
- "D": Days
- "YM": Months excluding years
- "YD": Days excluding years
- "MD": Days excluding months and years
Example
DATEDIF("2024-01-01", "2025-03-02", "Y") → Returns 1 (1 year)
DATEDIF("2024-01-01", "2025-03-02", "M") → Returns 14 (14 months)
DATEDIF(A1, B1, "D") → Returns the number of days between dates in cells A1 and B1